// <copyright file="CharacterBase.cs" company="TenneySoftware">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>Robert Tenney</author>
// <email>rob10e@yahoo.com</email>
// <date>April 2009</date>
// <summary>An abstract class that all characters, i.e.: Player/NonPlayer/Monsters inherit.</summary>

// License:

// Product: RPGRoguelikeEngine .Net
// Author: Robert N. Tenney
// Copyright: April 2009

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 2
// of the License.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

// This license covers all source code, binaries, and other materials related to this project
// unless specifically stated otherwise.

using System;
using System.Collections.Generic;

namespace TenneySoftware.Engine.Characters {
    /// <summary>
    /// An abstract class that all characters, i.e.: Player/NonPlayer/Monsters inherit.
    /// </summary>
    public abstract class CharacterBase {
        /// <summary>
        /// Race of the character.
        /// </summary>
        private CharacterRace race;

        /// <summary>
        /// Class of the character.
        /// </summary>
        private CharacterClass classOfCharacter;

        /// <summary>
        /// Character's attribute list.
        /// </summary>
        private Dictionary<CharacterAttributeIdentifier, int> attributeList;

        /// <summary>
        /// Character's skill list.
        /// </summary>
        private Dictionary<SkillIdentifier, int> skillList;

        /// <summary>
        /// Character's name.
        /// </summary>
        private string name;

        /// <summary>
        /// Character's decription.
        /// </summary>
        private string description;

        /// <summary>
        /// Character's health status.
        /// </summary>
        private int health;

        /// <summary>
        /// Character's magic strength (mana).
        /// </summary>
        private int magic;

        /// <summary>
        /// Character's armor class.
        /// </summary>
        private int armor;

        /// <summary>
        /// Character's attack strength.
        /// </summary>
        private int attack;

        /// <summary>
        /// Is the character sick.
        /// </summary>
        private bool isSick;

        /// <summary>
        /// Is the character enchanted.
        /// </summary>
        private bool isEnchanted;

        /// <summary>
        /// Is the character asleep.
        /// </summary>
        private bool isAsleep;

        /// <summary>
        /// Is the character dead.
        /// </summary>
        private bool isDead;

        /// <summary>
        /// The range that the character can see.
        /// </summary>
        private int visionRange;

        /// <summary>
        /// The actions that the character can perform.
        /// </summary>
        private Actions characterActions;

        /// <summary>
        /// The type of character.
        /// </summary>
        private CharacterType typeOfCharacter;

        /// <summary>
        /// The character's object indentification.
        /// </summary>
        private ObjectIdentifier identification;

        /// <summary>
        /// Initializes a new instance of the CharacterBase class.
        /// </summary>
        protected CharacterBase() {
            this.attributeList = new Dictionary<CharacterAttributeIdentifier, int>();
            this.skillList = new Dictionary<SkillIdentifier, int>();
            this.characterActions = new Actions();
            this.characterActions.Character = this;
            this.identification = new ObjectIdentifier();
        }

        /// <summary>
        /// Gets or sets the type of character.
        /// </summary>
        /// <value>
        /// The type of character.
        /// </value>
        public CharacterType TypeOfCharacter {
            get {
                return this.typeOfCharacter;
            }

            set {
                this.typeOfCharacter = value;
            }
        }

        /// <summary>
        /// Gets the character's object identification.
        /// </summary>
        /// <value>
        /// The character's object identification.</value>
        public ObjectIdentifier Identification {
            get {
                return this.identification;
            }
        }

        /// <summary>
        /// Gets or sets the actions of the character.
        /// </summary>
        /// <value>
        /// The actions of the character.
        /// </value>
        public Actions CharacterActions {
            get {
                return this.characterActions;
            }

            set {
                this.characterActions = value;
            }
        }

        /// <summary>
        /// Gets or sets the character's visual range.
        /// </summary>
        /// <value>
        /// The character's visual range.</value>
        public int VisionRange {
            get {
                return this.visionRange;
            }

            set {
                this.visionRange = value;
            }
        }

        /// <summary>
        /// Gets the character's name.
        /// </summary>
        /// <value>
        /// The character's name.
        /// </value>
        public string Name {
            get {
                return this.name;
            }
        }

        /// <summary>
        /// Gets the character's race.
        /// </summary>
        /// <value>
        /// The character's race.
        /// </value>
        public CharacterRace Race {
            get {
                return this.race;
            }
        }

        /// <summary>
        /// Gets or sets the character's class.
        /// </summary>
        /// <value>
        /// The character's class.
        /// </value>
        public CharacterClass ClassOfCharacter {
            get {
                return this.classOfCharacter;
            }

            set {
                this.classOfCharacter = value;
            }
        }

        /// <summary>
        /// Gets the list of attributes.
        /// </summary>
        /// <value>
        /// The list of attributes.
        /// </value>
        public Dictionary<CharacterAttributeIdentifier, int> AttributeList {
            get {
                return this.attributeList;
            }
        }

        /// <summary>
        /// Gets the list of skills.
        /// </summary>
        /// <value>
        /// The list of skills.
        /// </value>
        public Dictionary<SkillIdentifier, int> SkillList {
            get {
                return this.skillList;
            }
        }

        /// <summary>
        /// Gets or sets the description for the character.
        /// </summary>
        /// <value>
        /// The description for the character.
        /// </value>
        public string Description {
            get {
                return this.description;
            }
            
            set {
                this.description = value;
            }
        }

        /// <summary>
        /// Gets or sets the character's health status.
        /// </summary>
        /// <value>
        /// The character's health status.
        /// </value>
        public int Health {
            get {
                return this.health;
            }

            set {
                this.health = value;
            }
        }

        /// <summary>
        /// Gets or sets the character's magic strength (mana).
        /// </summary>
        /// <value>
        /// The character's magic strength (mana).
        /// </value>
        public int Magic {
            get {
                return this.magic;
            }

            set {
                this.magic = value;
            }
        }

        /// <summary>
        /// Gets or sets the character's armor strength.
        /// </summary>
        /// <value>
        /// The character's armor strength.
        /// </value>
        public int Armor {
            get {
                return this.armor;
            }

            set {
                this.armor = value;
            }
        }

        /// <summary>
        /// Gets or sets the character's attack strength.
        /// </summary>
        /// <value>
        /// The character's attack strength.
        /// </value>
        public int Attack {
            get {
                return this.attack;
            }

            set {
                this.attack = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the character is sick or not.
        /// </summary>
        /// <value>
        /// A value indicating whether the character is sick or not.
        /// </value>
        public bool IsSick {
            get {
                return this.isSick;
            }

            set {
                this.isSick = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the character is enchanted or not.
        /// </summary>
        /// <value>
        /// A value indicating whether the character is enchanted or not.
        /// </value>
        public bool IsEnchanted {
            get {
                return this.isEnchanted;
            }

            set {
                this.isEnchanted = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the character is asleep or not.
        /// </summary>
        /// <value>
        /// A value indicating whether the character is asleep or not.
        /// </value>
        public bool IsAsleep {
            get {
                return this.isAsleep;
            }

            set {
                this.isAsleep = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the character is dead or not.
        /// </summary>
        /// <value>
        /// A value indicating whether the character is dead or not.
        /// </value>
        public bool IsDead {
            get {
                return this.isDead;
            }

            set {
                this.isDead = value;
            }
        }

        /// <summary>
        /// Converts this class instance to a string.
        /// </summary>
        /// <returns>The string representation of this class.</returns>
        public override string ToString() {
            return this.name;
        }
        
        /// <summary>
        /// Sets the name of the character.
        /// </summary>
        /// <param name="name">Name to set.</param>
        protected void SetName(string name) {
            this.name = name;
        }

        /// <summary>
        /// Sets the race of character.
        /// </summary>
        /// <param name="race">The race to set.</param>
        protected void SetRace(CharacterRace race) {
            this.race = race;
        }
    }
}
